import {
  changeBtnsStatusAction, changeBtnsShowAction, changeBtnsUpateAction, DeleteValueAction, MenuDataAction,
  ChangeparentOffAction
} from './_action';

const stateData = {
  BtnsStatus: true,
  BtnsShowStatus: true,
  BtnsUpate: false,
  DeleteValue: false,
  parentOff: true,
  MenuData: {
    attr1: '',
    code: '',
    description: '',
    href: '',
    icon: '',
    id: '',
    order_num: '',
    parentId: '',
    path: '',
    title: '',
    type: '',
  }
};

export function changeBtnsStatus(state = stateData, action) {
  switch (action.type) {
    case 'changeBtnsStatus':
      var newState = JSON.parse(JSON.stringify(state));
      newState.BtnsStatus = action.BtnsStatus;
      return newState;
    case 'changeBtnsShow':
      var newState = JSON.parse(JSON.stringify(state));
      newState.BtnsShowStatus = action.BtnsShowStatus;
      return newState;
    case 'changeBtnsUpate':
      var newState = JSON.parse(JSON.stringify(state));
      newState.BtnsUpate = action.BtnsUpate;
      return newState;
    case 'DeleteValue':
      var newState = JSON.parse(JSON.stringify(state));
      newState.DeleteValue = action.DeleteValue;
      return newState;
    case 'ChangeParentOff':
      var newState = JSON.parse(JSON.stringify(state));
      newState.parentOff = action.parentOff;
      return newState;
    case 'changeMenuData':
      var newState = JSON.parse(JSON.stringify(state));
      console.log(newState);
      newState.MenuData = action.MenuData;
      return newState;
    default:
      return state;
  }
}


// export default setCounter;

